home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / C Internet Config / IC Component Source ƒ / PPC Code Resources.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-06  |  2.1 KB  |  43 lines  |  [TEXT/SPM ]

  1. /*
  2.     In PPC applications, constructors and destructors for global and static objects are called automatically
  3.     by __cplusstart, which is actually the main entry point to your application (and not main()).  This
  4.     routine calls your constructors, initializes your QuickDraw globals, calls your main() function, then
  5.     calls your destructors.
  6.     
  7.     In a shared library, constructors for global and static objects are called by __cplusinit, which the linker
  8.     assigns as an initialization routine.  The Code Fragment Manager will automatically call this initialization
  9.     routine when your shared library is loaded.  __cplusinit will also allow hook your shared library's
  10.     QuickDraw globals to the QuickDraw globals of the calling application.  Destructors for global and static
  11.     objects are called by __cplusterm, which the linker assigns as a termination routine.  The Code Fragment
  12.     Manager will automatically call this termination routine when your shared library is unloaded.
  13.     
  14.     In code resources, there is no way to call these constructors or destructors automatically, or hook
  15.     QuickDraw globals, and still preserve the arguments passed to your main entry point (main()).  Instead,
  16.     you will need to call initialization and termination routines to do this for you.
  17.     
  18.     In C, you should use __rsrcinit() and __rsrcterm(), defined in stdlib.h.
  19.     
  20.     In C++, you should use __cplusrsrcinit() and __cplusrsrcterm(), defined in new.h.
  21.     
  22.     The C++ initialization and termination routines will automatically call the C initialization and termination
  23.     routines.  You should only use one set or the other.
  24.     
  25.     You must not use any objects that rely on their constructor, or any QuickDraw globals, before calling
  26.     __rsrcinit() or __cplusrsrcinit().
  27.     
  28.     
  29.     Singlely-entrant code resources :
  30.     
  31.     If your code resource is called only once, you should call __rsrcinit() or __cplusrsrcinit() at the start of
  32.     main(), and __rsrcterm() or __cplusrsrcterm() at the end.
  33.     
  34.     Reentrant code resources :
  35.     
  36.     If your code resource is reentrant, you will need to call __rsrcinit() or __cplusrsrcinit() only the first
  37.     time through, and __rsrcterm() or __cplusrsrcterm() the last time through.
  38.     
  39.     
  40.     Colen Garoutte-Carson
  41.     Symantec Corp.
  42. */
  43.